'use strict'
const webpack = require('webpack')
const path = require('path')
module.exports = {
  mode: 'development', // 运行环境 development、production
  entry: {
    index:'./src/index.js',
    search:'./src/search.js'
  }, //入口
  output:{ // 出口
    path: path.join(__dirname,'dist'), // 文件所放目录
    filename: '[name].js' // 输出文件名
  },
  module: {
    rules: [ //loader的配置
      {
        test: /\.js$/,
        use: 'babel-loader'
      },
      {
        test: /\.css$/,
        use: [
        	'style-loader',
          'css-loader'
        ]
      },
      {
        test: /\.less$/,
        use: [
        	'style-loader',
          'css-loader',
          'less-loader'
        ]
      },
      {
        test: /\.(png|svg|jpg|gif|jpeg)$/,
        use: [
          'file-loader'
        ]
      }
    ]
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin()
  ],
  devServer: {
    contentBase: './dist',
    hot: true
  }
}